package com.lxl.mybatis1.book.mapper;

import com.lxl.mybatis1.book.pojo.Book;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Entity com.lxl.mybatis1.book.entity.Book
 */
@Mapper
public interface BookMapper {
//    @Select("select * from Book")
    public List<Book> findAllBooks();

//    @SelectProvider(method = "searchBookSql",type = SqlContext.class) //动态查询
//    public List<Book> searchBooks(Book book);

//    @Select("select * from Book where id=#{id}")
    public Book findBookById(int id);

//    @Insert("insert Book values(0,#{name},#{price},#{category},#{pnum},#{imgurl},#{description},#{author},#{sales})")
    public void addBook(Book book);

//    @Update("update Book set name=#{name},price=#{price},category=#{category},pnum=#{pnum},imgurl=#{imgurl},description=#{description},author=#{author},sales=#{sales} where id=#{id}")
    public void updateBook(Book book);

//    @Delete("delete from Book where id=#{id}")
    public void deleteBook(int id);

}
